package com.donica.wamstest.entity;

import java.io.File;
import java.sql.Timestamp;

import com.fasterxml.jackson.annotation.JsonFormat;

public class PackageDTO {
	private String id;
	private String package_type;
	private String uri;
	private String name;
	private String version;
	private String subtype;
	long size;
	long duration;
	private Object playlist;
	private Object filelist;
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+0")
	private Timestamp create_time;
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+0")
	private Timestamp update_time;
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getPackage_type() {
		return package_type;
	}
	public void setPackage_type(String package_type) {
		this.package_type = package_type;
	}
	public String getUri() {
		return uri;
	}
	public void setUri(String uri) {
		this.uri = uri;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getVersion() {
		return version;
	}
	public void setVersion(String version) {
		this.version = version;
	}
	public String getSubtype() {
		return subtype;
	}
	public void setSubtype(String subtype) {
		this.subtype = subtype;
	}
	public long getSize() {
		return size;
	}
	public void setSize(long size) {
		this.size = size;
	}
	public long getDuration() {
		return duration;
	}
	public void setDuration(long duration) {
		this.duration = duration;
	}
	public Timestamp getCreate_time() {
		return create_time;
	}
	public void setCreate_time(Timestamp create_time) {
		this.create_time = create_time;
	}
	public Timestamp getUpdate_time() {
		return update_time;
	}
	public void setUpdate_time(Timestamp update_time) {
		this.update_time = update_time;
	}
	
	public Object getPlaylist() {
		return playlist;
	}
	public void setPlaylist(Object playlist) {
		this.playlist = playlist;
	}
	public Object getFilelist() {
		return filelist;
	}
	public void setFilelist(Object filelist) {
		this.filelist = filelist;
	}
	public PackageDTO valueOf(PlaylistVO vo) {
		this.package_type = "program";
		this.version = vo.getVersion();
		this.subtype = vo.getType();
		this.uri = this.package_type + File.separator + vo.getVersion();
		return this;
	}
	
	public PackageDTO valueOf(FileDTO vo) {
		this.package_type = "software";
		this.name = vo.getName();
		this.version = vo.getName();
		this.size = vo.getSize();
		this.create_time = vo.getCreate_time();
		this.update_time = vo.getUpdate_time();
		this.uri = this.package_type + File.separator + vo.getName();
		return this;
	}

}
